<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=">
<title>后台管理系统</title>
<link rel="stylesheet" href="__PUBLIC__/Admin/css/css.css">
<script src="__PUBLIC__/Admin/js/jquery-1.9.1.js"></script>
<script src="__PUBLIC__/Common/Layer/layer.js"></script>
<script src="__PUBLIC__/Common/Ueditor/ueditor.config.js"></script>
<script src="__PUBLIC__/Common/Ueditor/ueditor.all.min.js"> </script>
<script src="__PUBLIC__/Common/Ueditor/lang/zh-cn/zh-cn.js"></script>
<script src="__PUBLIC__/Common/uploadPreview.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Common/My97Date/WdatePicker.js"></script>
<script>
   window.onload = function () { 
        new uploadPreview({ UpBtn: "pic_url", DivShow: "imgdiv", ImgShow: "imgShow" });
    }
</script>
<script>
    var ue = UE.getEditor('editor');
	var ue2 = UE.getEditor('editor2');
	var ue3 = UE.getEditor('editor3');
	var ue4 = UE.getEditor('editor4');
	var ue5 = UE.getEditor('editor5');
</script>
</head>
<body>

<div class="nav">
	<div class="nav_title">
    	<h4><img class="nav_img" src="__PUBLIC__/Admin/img/tab.gif" /><span class="nav_a"><php>echo urldecode($_GET['menu_title']);</php></span></h4>
    </div>
</div>
<form name="form3" method="post" action="__SELF__" enctype="multipart/form-data">
<div class="list">
	  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="details" style=" margin-top:2px;">
      	  <tr>
	        <td colspan="2" style=" background:#E4EEFA;"><h3 style="margin-left:50px;">一、基本信息</h3></td>
       	  </tr>
        <tbody>
	      <tr>
	        <td><div align="right">商品分类：</div></td>
	        <td><select id="class_id" name="class_fid">
            	<option value="">----------</option>
            <foreach name="result_class" item="vo">
            	<option value="{$vo.id}">{$vo.class_name}</option>
            </foreach>
            </select>
			<select id="abc" name="class_id">
            	<option value="0">----------</option>
            </select>
            </td>
          </tr>
	      <tr>
	        <td width="20%"><div align="right">
	        <div align="right"><span style="color:#F00;">*</span> 标题：</div></td>
	        <td width="80%">
	          <input name="title" type="text" class="input" id="title" size="80"> <span style="color:#00F;">长度请限制在 30 字以内</span>
            </td>
          </tr>
	      <tr>
	        <td><div align="right"><span style="color:#F00;">*</span>商品列表页单张主图：</div></td>
	        <td><span style="color:#F00;">建议图片尺寸请使用 （ 720 * 500 ） 像素</span>
	           	<div id="imgdiv"><img style="position:relative;top:6px;margin-right:30px;" id="imgShow" width="100" height="100" />
	           	<input type="file" name="pic_url[]" id="pic_url" /></div>   			
            </td>
          </tr>
	      <tr>
	        <td><div align="right">商品详情页图集：</div></td>
	        <td><span style="color:#F00;">建议图片尺寸宽度  （ 720 * 500 ）  像素</span><br/>
            <input type="file" name="pic_tuji[]" /><input type="button" name="add_button" id="add_button" value="添加一行" style="padding:2px 15px; background:#00F; color:#FFF;">
            <div id="append_img">
            </div>
            </td>
          </tr>
	        <td><div align="right">原价：</div></td>
	        <td><input type="text" style="color:#F00; font-weight:600;" name="price_old" id="price_old">
            <span style="color:#00F;">元</span></td>
          </tr>
	      <tr>
	        <td><div align="right">现价：</div></td>
	        <td><input type="text" style="color:#F00; font-weight:600;" name="price_new" id="price_new"> 
	        <span style="color:#00F;">元</span></td>
          </tr>
           <tr>
	        <td><div align="right">积分抵现价：</div></td>
	        <td><input type="text" style="color:#F00; font-weight:600;" name="dikou_jifen" id="offset"> 
	        </td>
          </tr>
           <tr>
	        <td><div align="right">积分返利：</div></td>
	        <td><input type="text" style="color:#F00; font-weight:600;" name="fanli_jifen" id="rebate"> 
	       </td>
          </tr>
	      <tr>
	        <td><div align="right">库存：</div></td>
	        <td><input type="text" style="color:#F00; font-weight:600;" name="kucun" id="kucun">
            <span style="color:#00F;">件</span></td>
          </tr>
		  <tr>
	        <td><div align="right">首页顶部推荐：</div></td>
	        <td>
			<input type="radio" name="home_tuijian" id="rexiao" value="0" <if condition="$result.home_tuijian == 0"> checked="checked" </if> >&nbsp;&nbsp;
              <laber for="rexaio">否</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="radio" name="home_tuijian" id="rexiao2" value="1" <if condition="$result.home_tuijian == 1"> checked="checked" </if> >
	          <laber for="rexaio2">是</label>
            </td>
          </tr>
		  <tr>
	        <td><div align="right">当季热卖：</div></td>
	        <td><input type="radio" name="dangji_remai" id="dangji_remai" value="0" <if condition="$result.dangji_remai == 0"> checked="checked" </if> >&nbsp;&nbsp;
              <laber for="dangji_remai">否</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="radio" name="dangji_remai" id="dangji_remai2" value="1" <if condition="$result.dangji_remai == 1"> checked="checked" </if> >
	          <laber for="dangji_remai2">是</label>
            </td>
          </tr>	
	      <tr>
	        <td><div align="right">是否热销：</div></td>
	        <td><input type="radio" name="rexiao" id="rexiao" value="radio" checked="0">&nbsp;&nbsp;
              <laber for="rexiao">否</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="radio" name="rexiao" id="rexiao2" value="1">
	          <laber for="rexiao2">是</label>
              </td>
          </tr>
          <tr>
	        <td><div align="right">是否广告：</div></td>
	        <td><input type="radio" name="advert" id="advert" value="radio" checked="0">&nbsp;&nbsp;
              <laber for="advert">否</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="radio" name="advert" id="advert2" value="1">
	          <laber for="advert2">是</label>
              </td>
          </tr>
          <tr>
	        <td><div align="right">是否推荐：</div></td>
	        <td><input type="radio" name="recommend" id="recommend" value="radio" checked="0">&nbsp;&nbsp;
              <laber for="rexiao">否</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="radio" name="recommend" id="recommend2" value="1">
	          <laber for="recommend2">是</label>
              </td>
          </tr>
	      <tr>
	        <td><div align="right">上下架：</div></td>
	        <td><input type="radio" name="shangjia" id="shangjia" value="1" checked="checked">&nbsp;&nbsp;
              <laber for="shangjia">上架</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="radio" name="shangjia" id="shangjia2" value="0">
	          <laber for="shangjia2">下架</label></td>
          </tr>
		  <tr>
	        <td><div align="right">出发日期：</div></td>
	        <td>
				<input name="chufa_date[]" type="text" class="Wdate" onClick="WdatePicker()">&nbsp;&nbsp;&nbsp;当日价格：
				(成人) <input name="chufa_price[]" type="text" style="width:80px;" />&nbsp;元&nbsp;&nbsp;&nbsp;
				(儿童) <input name="chufa_price_et[]" type="text" value="" style="width:80px;" />&nbsp;元
				<input type="button" id="add_chufa_date" style="padding:0 15px;" value="增加一行" />
				<div id="append_chufa_date"></div>
			<div id="append_chufa_date"></div></td>
          </tr>
		   <tr>
	        <td><div align="right">出发地点：</div></td>
	        <td><input name="chufa_address" type="text" id="chufa_address" class="input"></td>
          </tr>  
	      <tr>
	        <td><div align="right">标签：</div></td>
	        <td><input name="keyword" type="text" id="textfield4" class="input" size="80">
            <span style="color:#00F;">多个标签，请用空格分隔开</span></td>
          </tr>
          <tr>
	        <td><div align="right">产品详情：</div></td>
	        <td><script id="editor" name="shuoming" type="text/plain" style="width:1000px;height:600px;">{$result.shuoming}</script></td>
          </tr>
	      <tr>
	        <td><div align="right">行程介绍：</div></td>
	        <td><script id="editor2" name="guige" type="text/plain" style="width:1000px;height:600px;">{$result.guige}</script></td>
          </tr>
		  <tr>
	        <td><div align="right">推荐理由：</div></td>
	        <td><script id="editor3" name="tuijian_liyou" type="text/plain" style="width:1000px;height:600px;">{$result.tuijian_liyou}</script></td>
          </tr>
		  <tr>
	        <td><div align="right">预定须知：</div></td>
	        <td><script id="editor4" name="yuding_xvzhi" type="text/plain" style="width:1000px;height:600px;">{$result.yuding_xvzhi}</script></td>
          </tr>
		  <tr>
	        <td><div align="right">费用说明：</div></td>
	        <td><script id="editor5" name="feiyong_shuoming" type="text/plain" style="width:1000px;height:600px;">{$result.feiyong_shuoming}</script></td>
          </tr>
	      <tr>
	        <td><div align="right"></div></td>
	        <td>&nbsp;</td>
          </tr>
	      <tr>
	        <td><div align="right"></div></td>
	        <td>&nbsp;</td>
          </tr>
        </tbody>
  </table> 
</div>
<div class="footer">
     <button type="button" class="button"  id="button" style="min-width:160px;" onclick="check_form();">保存信息</button>
</div>
</form>
<script>
$(function(){
	$('#add_chufa_date').click(function(){
		var html = '<span><input name="chufa_date[]" type="text" class="Wdate" onClick="WdatePicker()">&nbsp;&nbsp;&nbsp;当日价格：&nbsp;(成人) <input name="chufa_price[]" type="text" style="width:80px;" />&nbsp;元&nbsp;&nbsp;&nbsp; (儿童) <input name="chufa_price_et[]" type="text" value="" style="width:80px;" />&nbsp;元&nbsp;<input type="button" onClick="del_chufa_date(this);" value="删除" style="padding:0 15px;" /></span><br/>';
		$('#append_chufa_date').append(html);
	});
});
</script>
<script>
function del_chufa_date(_this){
	$(_this).parent().remove();
}
</script>
<script>
$(function(){
	$('#add_button').click(function(){
		  var html = '<div><input type="file" name="pic_tuji[]" />'+
            		 '<input type="button" name="add_button" id="add_button" onClick="del_tuji(this);" value="删除" style="padding:2px 10px;"><div/>';
		$('#append_img').append(html);
	});
});
</script>
<script>
function del_tuji(_this){
	$(_this).parent().remove();
}
</script>
<script type="text/javascript">
	$(function() {
		$("#class_id").change(function() {
			var class_id = $("#class_id").val();
			$.ajax({
				data:'id='+class_id,
				type:"post",
				url:"{:U('Goods/ajaxgoods')}",
				success:function(msg) {
					console.log(msg)
					if(msg != 0){
						$("#abc").html('<option value="0">----------</option>');
						$.each(msg,function(k,v) {
								$("#abc").append('<option value='+v.id+'>'+v.class_name+'</option>');
						});
					}else{
						parent.layer.msg('没有2级分类，请添加！', {icon: 2, time: 2000 }); 
						$("#abc").html('<option value="0">----------</option>');
					}
				}
			});
		});
	});
</script>
<script>
function check_form(){
	var title = $('#title').val();
	if(title == ''){
		layer.msg('活动名称不能为空');
		return false;
	}
	var pic_url = $('#pic_url').val();
	if(pic_url == ''){
		layer.msg('代表图片不能为空');
		return false;
	}
	var class_id = parseInt($('#abc').val());
	console.log(class_id);
	if(class_id ==0){
		layer.msg('2级分类不能为空');
		return false;
	}else{
		$('form').submit();
	}
	
}
</script>
</body>
</html>
